<template>
	<view class="page">
		<view class="title">
			5.16.request各种不同类型的参数详解
		</view>
		<view class="p">
			官网链接API
			<uni-link href="https://uniapp.dcloud.net.cn/api/request/request.html" text="发送网络请求"
				color="#007BFF"></uni-link>
		</view>
		<view class="p">
			主要的参数有method请求类型，timeout超时时间，header和success回调地狱和，fail错误和complete结束。
		</view>
		<view class="box">
			<view class="p h2">
				{{arss.title}}
			</view>
			<view class="p">
				{{arss.body}}
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		ref
	} from 'vue'

	const arss = ref({
		title: '',
		body: ''
	})
	async function request() {
		let res = await uni.request({
			url: "https://jsonplaceholder.typicode.com/posts",
			method: 'GET',
			data: {
				id: "1",
			}
		})
		arss.value = res.data[0]
	}

	request()
</script>

<style lang="scss" scoped>

</style>